{% extends "base.html" %}
{% block content %}
    <div class="posts">
        {% for article in article_list %}
            <section class="post">
                <header class="post-header">
                    <h2 class="post-title"><a href="{% url 'detail' id=article.id %}">{{ article.title }}</a></h2>
                    <p class="post-meta">
                        发布时间: <a class="post-author" href="#">{{ article.pub_time |date:'Y/m/d H:i:s'}}</a>&nbsp;&nbsp;
                        分类: <a class="post-category post-category-pure" href="#">{{ article.category.name }}</a>&nbsp;&nbsp;
                        标签:
                        {% for tag in article.tags.all %}
                            <a class="post-category post-category-pure" href="#">{{ tag.name }}</a>
                        {% endfor %}&nbsp;&nbsp;
                        浏览次数：{{ article.views }}
                    </p>
                </header>

                <div class="post-description">
                    <p>
                        {#  小坑 冒号后不能有空格，否则报cant'parse错误。 建议前端尽量减少逻辑，放到views.py中完成 #}
                        {{ article.content|truncatewords_html:100 }}
                    </p>
                </div>
                {# 小坑 article_id=article.id url传参时跟这里定义的article_id无关，都会按照值的字段名id传 #}
                <div><a class="post-category post-category-design" href="{%  url 'detail' id=article.id %}">阅读全文</a></div>

            </section>
        {% endfor %}
    </div><!-- /.blog-post -->

    <!--页码-->
    <div>
      <a class="footer" href="#" ><i class="fa fa-angle-left"></i>上一页</a>
      <button>{{ page_no }}</button>
      <a class="footer" href="#" >下一页<i class="fa fa-angle-right"></i></a>
    </div>
{% endblock %}